#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'
struct Node {
    int x, y;
};

const int maxn = 101;
int g[maxn][maxn];
int book[maxn][maxn];
int fx[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};//四连通 顺时针方向
int n, m;
int x, y;

int bfs(int x, int y) {
    int cnt = 0;
    queue<Node> Q;
    Q.push({x, y});
    book[x][y] = 1;
    while (Q.size()) {
        Node head = Q.front();
        cerr << "(" << head.x << "," << head.y << ")" << g[head.x][head.y] << endl;
        for (int i = 0; i < 4; i++) {
            int nx = head.x + fx[i][0];
            int ny = head.y + fx[i][1];
            if (nx < 0 || nx >= n || ny < 0 || ny >= m || book[nx][ny] == 1 || g[nx][ny] == 0)continue;
            Q.push({nx, ny});
            book[nx][ny] = 1;
        }
        Q.pop();
        ++cnt;
    }
    return cnt;
}


int main() {
    //freopen("A.in", "r", stdin);// file C-Style
    ifstream cin("A.in");//file Cpp-Style
    while (cin >> n >> m >> x >> y) {
        memset(book, 0, sizeof(book));//多组计算必须每次都要重置book
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)cin >> g[i][j];
        cout << bfs(x-1, y-1) << endl;

    }
    return 0;
}
